<?xml version="1.0" encoding="utf-8" ?> 
<xs:schema 
    elementFormDefault="unqualified" 
    attributeFormDefault="unqualified" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://schemas.microsoft.com/VisualStudio/2008/workitemtracking/typedef"
    xmlns="http://schemas.microsoft.com/VisualStudio/2008/workitemtracking/typedef"
    xmlns:typelib="http://schemas.microsoft.com/VisualStudio/2008/workitemtracking/typelib">

    <xs:import namespace="http://schemas.microsoft.com/VisualStudio/2008/workitemtracking/typelib"/>
    
    <!-- Simple types -->
    <!-- Help text -->
    <xs:simpleType name="HelpText">
        <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="255"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- Filter items -->
    <xs:simpleType name="FilterItems">
        <xs:restriction base="xs:string">
            <xs:enumeration value="excludegroups" />
        </xs:restriction>
    </xs:simpleType>
    <!-- Field type -->
    <xs:simpleType name="FieldType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="String" />
            <xs:enumeration value="Integer" />
            <xs:enumeration value="Double" />
            <xs:enumeration value="DateTime" />
            <xs:enumeration value="PlainText" />
            <xs:enumeration value="HTML" />
            <xs:enumeration value="TreePath" />
            <xs:enumeration value="History" />
            <xs:enumeration value="GUID" />
            <xs:enumeration value="Boolean"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- Field reportability -->
    <xs:simpleType name="Reportability">
        <xs:restriction base="xs:string">
            <xs:enumeration value="dimension" />
            <xs:enumeration value="detail" />
            <xs:enumeration value="measure" />
        </xs:restriction>
    </xs:simpleType>
    <!-- Measuring formula -->
    <xs:simpleType name="MeasureFormula">
        <xs:restriction base="xs:string">
            <xs:enumeration value="sum" />
            <xs:enumeration value="count" />
            <xs:enumeration value="distinctcount" />
            <xs:enumeration value="avg" />
            <xs:enumeration value="min" />
            <xs:enumeration value="max" />
        </xs:restriction>
    </xs:simpleType>
    <!-- Copy from -->
    <xs:simpleType name="CopyFrom">
        <xs:restriction base="xs:string">
            <xs:enumeration value="value" />
            <xs:enumeration value="field" />
            <xs:enumeration value="clock" />
            <xs:enumeration value="currentuser" />
        </xs:restriction>
    </xs:simpleType>
    <!-- Default from for SERVERDEFAULT rules -->
    <xs:simpleType name="ServerDefaultFrom">
        <xs:restriction base="xs:string">
            <xs:enumeration value="clock" />
            <xs:enumeration value="currentuser" />
            <xs:enumeration value="guid"/>
        </xs:restriction>
    </xs:simpleType>
    
    <!-- Complex types -->
    
    <!-- WITD (root element) -->
    <xs:complexType name="Witd">
        <xs:sequence>
            <xs:element name="WORKITEMTYPE" type="WorkItemType" />
        </xs:sequence>
        <xs:attribute name="application" fixed="Work item type editor" />
        <xs:attribute name="version" fixed="1.0" use="required"/>
    </xs:complexType>
    <!-- WORKITEMTYPE -->
    <xs:complexType name="WorkItemType">
        <xs:sequence>
            <xs:element name="DESCRIPTION" type="typelib:NonEmptyLargeText" minOccurs="0" />
            <xs:element name="GLOBALLISTS" type="typelib:GlobalListsDef" minOccurs="0"/>
            <xs:element name="FIELDS" type="FieldDefinitions" />
            <xs:element name="WORKFLOW" type="Workflow" />
            <xs:element name="FORM" type="Form" />
        </xs:sequence>
        <xs:attribute name="name" type="typelib:NonEmptyPlainConstant" use="required" />
    </xs:complexType>
    <!-- FIELDS (field definitions) -->
    <xs:complexType name="FieldDefinitions">
        <xs:sequence >
            <xs:element name="FIELD" type="FieldDefinition" maxOccurs="unbounded" />
        </xs:sequence >
    </xs:complexType>
    <!-- FIELD (field definition) -->
    <xs:complexType name="FieldDefinition">
        <xs:sequence minOccurs="0" >
            <xs:group ref="PlainRules" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="HELPTEXT" type="HelpTextRule" minOccurs="0" maxOccurs="1"/>
            <xs:group ref="PlainRules" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="name" type="typelib:FieldName" use="required" />
        <xs:attribute name="refname" type="typelib:ReferenceFieldName" use="required" />
        <xs:attribute name="type" type="FieldType" use="required" />
        <xs:attribute name="syncnamechanges" type="xs:boolean" use="optional" />
        <xs:attribute name="reportable" type="Reportability" use="optional" />
        <xs:attribute name="formula" type="MeasureFormula" use="optional" />
        <xs:attribute name="reportingname" type="typelib:FieldName" use="optional" />
        <xs:attribute name="reportingrefname" type="typelib:ReferenceFieldName" use="optional" />
    </xs:complexType>
    <!-- Plain rules (rules + conditions; no help text) -->
    <xs:group name="PlainRules">
        <xs:sequence>
            <xs:choice>
                <xs:group ref="Rules"/>
                <xs:group ref="Conditions"/>
            </xs:choice>
        </xs:sequence>
    </xs:group>
    <!-- HELPTEXT -->
    <xs:complexType name="HelpTextRule">
        <xs:simpleContent>
            <xs:extension base="HelpText" />
        </xs:simpleContent>
    </xs:complexType>
    <!-- Rules -->
    <xs:group name="Rules">
        <xs:choice>
            <xs:element name="REQUIRED" type="PlainRule" />
            <xs:element name="READONLY" type="PlainRule" />
            <xs:element name="EMPTY" type="PlainRule" />
            <xs:element name="FROZEN" type="PlainRule" />
            <xs:element name="CANNOTLOSEVALUE" type="PlainRule" />
            <xs:element name="NOTSAMEAS" type="FieldRule" />
            <xs:element name="VALIDUSER" type="ValidUserRule" />
            <xs:element name="ALLOWEXISTINGVALUE" type="EmptyRule" />
            <xs:element name="MATCH" type="PatternRule" />
            <xs:element name="ALLOWEDVALUES" type="ListRule" />
            <xs:element name="SUGGESTEDVALUES" type="ListRule"  />
            <xs:element name="PROHIBITEDVALUES" type="ListRule"  />
            <xs:element name="DEFAULT" type="DefaultRule" />
            <xs:element name="COPY" type="CopyRule" />
            <xs:element name="SERVERDEFAULT" type="ServerDefaultRule" />
        </xs:choice>
    </xs:group>
    <!-- Plain rule (REQUIRED, READONLY, etc) -->
    <xs:complexType name="PlainRule">
        <xs:attribute name="for" type="typelib:IdentityName" />
        <xs:attribute name="not" type="typelib:IdentityName" />
    </xs:complexType>
    <!-- Field rule (NOTSAMEAS) -->
    <xs:complexType name="FieldRule">
        <xs:complexContent>
            <xs:extension base="PlainRule">
                <xs:attribute name="field" type="typelib:ReferenceFieldName" use="required" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- Value rule (any rule with 'value' attribute referring to a constant) -->
    <xs:complexType name="PatternRule">
        <xs:complexContent>
            <xs:extension base="PlainRule">
                <xs:attribute name="pattern" type="typelib:NonEmptyPlainConstant" use="required"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- Valid user rule (VALIDUSER) -->
    <xs:complexType name="ValidUserRule" >
        <xs:complexContent>
            <xs:extension base="PlainRule">
                <xs:attribute name="group" type="typelib:IdentityName" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- Empty rule (ALLOWEXISTINGVALUE) -->
    <xs:complexType name="EmptyRule" />
    <!-- Copy rule (COPY)-->
    <xs:complexType name="CopyRule">
        <xs:complexContent>
            <xs:extension base="PlainRule">
                <xs:attribute name="from" type="CopyFrom" use="required" />
                <xs:attribute name="value" type="typelib:Constant" />
                <xs:attribute name="field" type="typelib:ReferenceFieldName" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- Default rule (DEFAULT) -->
    <xs:complexType name="DefaultRule">
        <xs:complexContent>
            <xs:restriction base="CopyRule">
                <xs:attribute name="value" type="typelib:NonEmptyConstant" />
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>
    <!-- Server default rule (SERVERDEFAULT) -->
    <xs:complexType name="ServerDefaultRule">
        <xs:complexContent>
            <xs:extension base="PlainRule">
                <xs:attribute name="from" type="ServerDefaultFrom" use="required" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- List rule (ALLOWEDVALUES, SUGGESTEDVALUES, PROHIBITEDVALUES) -->
    <xs:complexType name="ListRule">
        <xs:complexContent>
            <xs:extension base="PlainRule">
                <xs:sequence maxOccurs="unbounded">
                    <xs:choice>
                        <xs:element name="GLOBALLIST" type="typelib:GlobalList" />
                        <xs:element name="LISTITEM" type="typelib:ListItem" />
                    </xs:choice>
                </xs:sequence>
                <xs:attribute name="expanditems" type="xs:boolean" default="true" />
                <xs:attribute name="filteritems" type="FilterItems" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- Conditions -->
    <xs:group name="Conditions">
        <xs:choice>
            <xs:element name="WHEN" type="FieldValueCondition" />
            <xs:element name="WHENNOT" type="FieldValueCondition" />
            <xs:element name="WHENCHANGED" type="FieldCondition" />
            <xs:element name="WHENNOTCHANGED" type="FieldCondition" />
        </xs:choice>
    </xs:group>
    <!-- Field condition (WHENCHANGED, WHENNOTCHANGED) -->
    <xs:complexType name="FieldCondition">
        <xs:choice minOccurs="1" maxOccurs="unbounded">
            <xs:group ref="Rules" />
        </xs:choice>
        <xs:attribute name="field" type="typelib:ReferenceFieldName" use="required" />
    </xs:complexType>
    <!-- Field value condition (WHEN, WHENNOT) -->
    <xs:complexType name="FieldValueCondition">
        <xs:complexContent>
            <xs:extension base="FieldCondition">
                <xs:attribute name="value" type="typelib:Constant" use="required" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- WORKFLOW -->
    <xs:complexType name="Workflow">
        <xs:sequence>
            <xs:element name="STATES" type="States" />
            <xs:element name="TRANSITIONS" type="Transitions" />
        </xs:sequence>
    </xs:complexType>
    <!-- States (STATES) -->
    <xs:complexType name="States">
        <xs:sequence>
            <xs:element name="STATE" type="State" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <!-- State -->
    <xs:complexType name="State">
        <xs:sequence>
            <xs:element name="FIELDS" type="FieldReferences" minOccurs="0" />
        </xs:sequence>
        <xs:attribute name="value" type="typelib:NonEmptyPlainConstant" use="required" />
    </xs:complexType>
    <!-- Field references (FIELDS) -->
    <xs:complexType name="FieldReferences">
        <xs:sequence>
            <xs:element name="FIELD" type="FieldReference" minOccurs="1" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>
    <!-- Field reference (FIELD) -->
    <xs:complexType name="FieldReference">
        <!-- At least one rule or condition -->
        <xs:sequence minOccurs="1" maxOccurs="unbounded">
            <xs:group ref="PlainRules"/>
        </xs:sequence>
        <xs:attribute name="refname" type="typelib:ReferenceFieldName" use="required"/>
    </xs:complexType>
    <!-- Transitions (TRANSITIONS) -->
    <xs:complexType name="Transitions">
        <xs:sequence>
            <xs:element name="TRANSITION" type="Transition" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>
    <!-- Transition (TRANSITION) -->
    <xs:complexType name="Transition">
        <xs:all>
            <xs:element name="ACTIONS" type="ActionList" minOccurs="0" />
            <xs:element name="REASONS" type="Reasons" />
            <xs:element name="FIELDS" type="FieldReferences" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="from" type="typelib:PlainConstant" use="required" />
        <xs:attribute name="to" type="typelib:NonEmptyPlainConstant" use="required" />
        <xs:attribute name="for" type="typelib:IdentityName" />
        <xs:attribute name="not" type="typelib:IdentityName" />
    </xs:complexType>
    <!-- Action list (ACTIONS) -->
    <xs:complexType name="ActionList">
        <xs:sequence>
            <xs:element name="ACTION" type="typelib:ListItem" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>
    <!-- Reasons (REASONS) -->
    <xs:complexType name="Reasons">
        <xs:sequence>
            <xs:element name="REASON" type="Reason" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="DEFAULTREASON" type="Reason" />
            <xs:element name="REASON" type="Reason" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>
    <!-- Reason (REASON) -->
    <xs:complexType name="Reason">
        <xs:sequence>
            <xs:element name="FIELDS" type="FieldReferences" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute name="value" type="typelib:NonEmptyPlainConstant" use="required" />
    </xs:complexType>

    <!-- Root element -->
    <xs:element name="WITD" type="Witd" />

<!-- ****BEGIN**** Form Definition schema ****BEGIN**** -->    
    <xs:complexType name="Form">
        <xs:sequence>
            <xs:element name="Layout" type="LayoutType" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="LayoutType">
        <xs:choice minOccurs="1" maxOccurs="unbounded">
            <xs:element name="Group" type="GroupType" minOccurs="0"/>
            <xs:element name="Control" type="ControlType" minOccurs="0"/>
            <xs:element name="TabGroup" type="TabGroupType" minOccurs="0"/>
            <xs:element name="Splitter" type="SplitterType" minOccurs="0"/>
        </xs:choice>
        <xs:attribute name="Target" type="xs:string" use="optional" />
        <xs:attribute name="MinimumSize" type="SizeType" use="optional" />
        <xs:attribute name="Padding" type="PaddingType" use="optional" />
        <xs:attribute name="Margin" type="PaddingType" use="optional" />
        <xs:attribute name="ControlSpacing" type="PositiveInteger" use="optional" />
        <xs:attribute name="LabelSpacing" type="PositiveInteger" use="optional" />
    </xs:complexType>

    <xs:complexType name="GroupType">
        <xs:sequence>
            <xs:element name="Column" type="ColumnType" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="Label" type="LabelType" use="optional" />
        <xs:attribute name="Padding" type="PaddingType" use="optional" />
        <xs:attribute name="Margin" type="PaddingType" use="optional" />
    </xs:complexType>

    <xs:complexType name="ColumnType">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="Group"      type="GroupType"    minOccurs="0" />
            <xs:element name="Control"    type="ControlType"    minOccurs="0" />
            <xs:element name="TabGroup"   type="TabGroupType" minOccurs="0" />
            <xs:element name="Splitter"   type="SplitterType"    minOccurs="0" />
        </xs:choice>
        <xs:attribute name="PercentWidth" type="PercentWidthType" use="optional" />
        <xs:attribute name="FixedWidth"   type="FixedWidthType" use="optional" />
    </xs:complexType>

    <xs:complexType name="TabGroupType">
        <xs:sequence>
            <xs:element name="Tab" type="TabType" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="Padding" type="PaddingType" use="optional" />
        <xs:attribute name="Margin" type="PaddingType" use="optional" />
    </xs:complexType>

    <xs:complexType name="TabType">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="Group" type="GroupType" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="Control" type="ControlType" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="TabGroup" type="TabGroupType" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="Splitter" type="SplitterType" minOccurs="0" maxOccurs="unbounded" />
        </xs:choice>
        <xs:attribute name="Label" type="LabelType" use="required"/>
        <xs:attribute name="Padding" type="PaddingType" use="optional" />
        <xs:attribute name="Margin" type="PaddingType" use="optional" />
    </xs:complexType>

    <xs:simpleType name="ValidControlsType">
        <xs:restriction base="xs:string">
        </xs:restriction>
    </xs:simpleType>


    <xs:simpleType name="LinksControlFilterKind">
      <xs:restriction base="xs:string">
        <xs:enumeration value="include" />
        <xs:enumeration value="exclude" />
        <xs:enumeration value="includeAll" />
        <xs:enumeration value="excludeAll" />
      </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="LinksControlFilterOnKind">
      <xs:restriction base="xs:string">
        <xs:enumeration value="forwardname" />
        <xs:enumeration value="reversename" />
      </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ExternalLinkTypeName">
      <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
        <xs:maxLength value="128"/>
      </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="LinksControlWorkItemTypeFilterKind">
        <xs:restriction base="xs:string">
            <xs:enumeration value="include" />
            <xs:enumeration value="exclude" />
            <xs:enumeration value="includeAll" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="LinksControlWorkItemTypeFilterScopeKind">
        <xs:restriction base="xs:string">
            <xs:enumeration value="project" />
            <xs:enumeration value="all" />
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="LinksControlWorkItemTypeFilterElementType" >
        <xs:attribute name="WorkItemType" type="typelib:NonEmptyPlainConstant" use="required" />
    </xs:complexType>

    <xs:complexType name="LinksControlWorkItemTypeFiltersElementType" >
        <xs:sequence>
            <xs:element name="Filter" type="LinksControlWorkItemTypeFilterElementType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="Scope" type="LinksControlWorkItemTypeFilterScopeKind" use="optional" />
        <xs:attribute name="FilterType" type="LinksControlWorkItemTypeFilterKind" use="required" />
    </xs:complexType>

    <xs:complexType name="WorkItemLinkFilterElementType" >
      <xs:attribute name="LinkType" type="typelib:ReferenceFieldName" use="required" />
      <xs:attribute name="FilterOn" type="LinksControlFilterOnKind" use="optional" />
    </xs:complexType>

    <xs:complexType name="ExternalLinkFilterElementType" >
      <xs:attribute name="LinkType" type="ExternalLinkTypeName" use="required" />
    </xs:complexType>

    <xs:complexType name="WorkItemLinkFiltersType" >
      <xs:sequence>
        <xs:element name="Filter" type="WorkItemLinkFilterElementType" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="FilterType" type="LinksControlFilterKind" use="required" />
    </xs:complexType>

    <xs:complexType name="ExternalLinkFiltersType" >
      <xs:sequence>
        <xs:element name="Filter" type="ExternalLinkFilterElementType" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="FilterType" type="LinksControlFilterKind" use="required" />
    </xs:complexType>

    <xs:complexType name="LinkColumnType" >
      <!-- Must be one or the other, but not both -->
      <xs:attribute name="LinkAttribute" type="typelib:ReferenceFieldName" use="optional" />
      <xs:attribute name="RefName" type="typelib:ReferenceFieldName" use="optional" />
    </xs:complexType>

    <xs:complexType name="LinkColumnsType" >
      <xs:sequence>
        <xs:element name="LinkColumn" type="LinkColumnType" minOccurs="1" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>

    <xs:complexType name="LinksControlOptionsType">
      <xs:all>
        <xs:element name="LinkColumns"      type="LinkColumnsType"    minOccurs="0" maxOccurs="1" />
        <xs:element name="WorkItemLinkFilters"    type="WorkItemLinkFiltersType"    minOccurs="0" maxOccurs="1"/>
        <xs:element name="ExternalLinkFilters"   type="ExternalLinkFiltersType" minOccurs="0" maxOccurs="1" />
        <xs:element name="WorkItemTypeFilters"   type="LinksControlWorkItemTypeFiltersElementType" minOccurs="0" maxOccurs="1" />
      </xs:all>
    </xs:complexType>

    <xs:complexType name="CustomControlOptionsType">
      <xs:sequence>
        <xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>

    <xs:complexType name="HyperLinkType" >
      <xs:sequence>
        <xs:element name="Param" type="HyperLinkParamType" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="UrlRoot"  type="NonBlankString" use="required" />
      <xs:attribute name="UrlPath"  type="NonBlankString" use="optional" />
    </xs:complexType>

  <xs:complexType name="HyperLinkParamType" >
      <xs:attribute name="Index"     type="PositiveInteger" use="required" />
      <xs:attribute name="Value"     type="xs:string" use="required" />
      <xs:attribute name="Type" type="HyperLinkParamValueKind" use="optional" />
    </xs:complexType>

    <xs:complexType name="TextElementType" mixed="true">
      <xs:sequence>
        <xs:element name="Link" type="HyperLinkType" minOccurs="0" maxOccurs="1" />
      </xs:sequence>
    </xs:complexType>

    <xs:complexType name="LabelElementType">
      <xs:sequence>
        <xs:element name="Text" type="TextElementType" minOccurs="1" maxOccurs="unbounded" />
      </xs:sequence>
    </xs:complexType>

  <xs:complexType name="WebpageControlOptionsType">
    <xs:choice minOccurs="1" maxOccurs="1">
      <xs:element name="Link" type="HyperLinkType"/>
      <xs:element name="Content" type="xs:string"/>
    </xs:choice>
    <xs:attribute name="AllowScript" type="xs:boolean" use="optional" />
    <xs:attribute name="ReloadOnParamChange" type="xs:boolean" use="optional" />
  </xs:complexType>

  <xs:complexType name="ControlType">
        <xs:sequence>
          <xs:choice minOccurs="0" maxOccurs="1">
            <xs:element name="Link" type="HyperLinkType" minOccurs="0" maxOccurs="1" />
            <xs:element name="LabelText" type="LabelElementType" minOccurs="0" maxOccurs="1" />
          </xs:choice>
          <xs:choice minOccurs="0" maxOccurs="1">
            <xs:element name="CustomControlOptions" type="CustomControlOptionsType" minOccurs="0" maxOccurs="1" />
            <xs:element name="LinksControlOptions" type="LinksControlOptionsType" minOccurs="0" maxOccurs="1" />
            <xs:element name="WebpageControlOptions" type="WebpageControlOptionsType" minOccurs="0" maxOccurs="1" />
          </xs:choice>
        </xs:sequence>
        <xs:attribute name="FieldName" type="typelib:ReferenceFieldName" use="optional" />
        <xs:attribute name="Type" type="ValidControlsType" use="required" />
        <xs:attribute name="Label"     type="LabelType" use="optional" />
        <xs:attribute name="LabelPosition" type="LabelPositionType" />
        <xs:attribute name="Dock"     type="DockType" use="optional" />
        <xs:attribute name="Padding" type="PaddingType" use="optional" />
        <xs:attribute name="Margin" type="PaddingType" use="optional" />
        <xs:attribute name="ReadOnly" type="ReadOnlyType" use="optional" />
        <xs:attribute name="MinimumSize" type="SizeType" use="optional" />
        <xs:attribute name="Name" type="NonBlankString" use="optional" />
        <xs:anyAttribute processContents="skip"/>
    </xs:complexType>

    <xs:complexType name="SplitterType">
        <xs:attribute name="Dock" type="DockType" use="required"/>
    </xs:complexType>

    <xs:simpleType name="FixedWidthType">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="1" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="PositiveInteger">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="0" />
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="PercentWidthType">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="1"/>
            <xs:maxInclusive value="100"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="LabelType">
        <xs:restriction  base="xs:string">
            <xs:maxLength value="80"/>
        </xs:restriction>
    </xs:simpleType>            

    <xs:simpleType name="LabelPositionType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Top"/>
            <xs:enumeration value="Bottom"/>
            <xs:enumeration value="Left"/>
            <xs:enumeration value="Right"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="DockType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Fill"/>
            <xs:enumeration value="Top"/>
            <xs:enumeration value="Bottom"/>
            <xs:enumeration value="Left"/>
            <xs:enumeration value="Right"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="ReadOnlyType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="True"/>
            <xs:enumeration value="False"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="SizeType">
        <xs:restriction  base="xs:string">
            <xs:pattern value="^\(\d+\,\d+\)$"/>
        </xs:restriction>
    </xs:simpleType>            

    <xs:simpleType name="PaddingType">
        <xs:restriction  base="xs:string">
            <xs:pattern value="^\(\d+\,\d+\,\d+\,\d+\)$"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="NonBlankString">
      <xs:restriction  base="xs:string">
        <xs:pattern value=".*\S+.*"/>
      </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="HyperLinkParamValueKind">
      <xs:restriction base="xs:string">
        <xs:enumeration value="Original"/>
        <xs:enumeration value="Current"/>
      </xs:restriction>
    </xs:simpleType>   
</xs:schema>
<!-- *****END***** Form Definition schema *****END*****  -->
